﻿<Window x:Class="WpfEncryption.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="Encryption Copyright © 2012 Youngj" AllowDrop="True"
        Height="470" Width="400" MinWidth="400" MinHeight="400"
        Icon="encrypted.ico" SourceInitialized="SandAndFire"  Drop="Window_Drop_1" >
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition />
        </Grid.ColumnDefinitions>

        <Grid Grid.ColumnSpan="2">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition />
            </Grid.ColumnDefinitions>
            <TextBlock Text="{Binding Path=IsChecked, ElementName=chbIsFile,Converter={StaticResource TextFileConverter}}" 
                   Margin="10,10,15,0" />
            <Grid Grid.Column="1" >
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition  Width="Auto"/>
                </Grid.ColumnDefinitions>
                <TextBox Name="textEncrypt" Text="{Binding Path=IsChecked,ElementName=chbIsFile,Converter={StaticResource DropTextConverter}}"  Margin="10,10,5,0" AllowDrop="True" Drop="textEncrypt_Drop" />
                <Button x:Name="btnBrowser" Grid.Column="1" Content="..." Width="30" 
                    Margin="5,10,5,0" Click="btnBrowser_Click" 
                    Visibility="{Binding Path=IsChecked,ElementName=chbIsFile,Converter={StaticResource VisiableConverter}}"/>
            </Grid>

            <TextBlock Grid.Row="1" Grid.ColumnSpan="2" 
                       Text="{Binding Path=Text, ElementName=textEncrypt,Converter={StaticResource FileSizeConverter}}" 
                   Margin="30,10,15,0" FontWeight="Bold" FontSize="14"
                       Visibility="{Binding Path=IsChecked,ElementName=chbIsFile,Converter={StaticResource VisiableConverter}}"/>

        </Grid>
        <StackPanel Orientation="Horizontal" Grid.Row="1" Grid.ColumnSpan="2">
            <CheckBox x:Name="chb" Content="Upper case" Margin="8" />
            <CheckBox x:Name="chbIsFile" Content="Is file" Margin="18,8,8,8" IsChecked="False"/>
            <CheckBox x:Name="chbAll" Content="Check all" Margin="8" IsChecked="False" />
            <Button x:Name="btnGenerator" Content="Generator" Width="80" Margin="10,5,5,5" Click="btnGenerator_Click" />
        </StackPanel>
        <CheckBox Grid.Row="2" x:Name="chbMD5" Content="MD5" Margin="8,10,15,0" 
                  IsChecked="{Binding Path=IsChecked,ElementName=chbAll,Mode=OneWay}"/>
        <TextBox Name="textMD5" Grid.Row="2" Grid.Column="1" Margin="10,10,5,0" TextWrapping="Wrap">
            <TextBox.Text>
                <MultiBinding Converter="{StaticResource MD5Converter}" Mode="TwoWay">
                    <Binding  Path="Text" ElementName="textEncrypt" />
                    <Binding  Path="IsChecked" ElementName="chb" />
                    <Binding  Path="IsChecked" ElementName="chbIsFile" />
                    <Binding  Path="IsChecked" ElementName="chbMD5" />
                </MultiBinding>
            </TextBox.Text>
        </TextBox>

        <CheckBox Grid.Row="3" x:Name="chbSHA1" Content="SHA1" Margin="8,10,15,0" 
                  IsChecked="{Binding Path=IsChecked,ElementName=chbAll,Mode=OneWay}"/>
        <TextBox Name="textSHA1" Grid.Row="3" Grid.Column="1" Margin="10,10,5,0" TextWrapping="Wrap">
            <TextBox.Text>
                <MultiBinding Converter="{StaticResource SHA1Converter}" Mode="TwoWay">
                    <Binding  Path="Text" ElementName="textEncrypt" />
                    <Binding  Path="IsChecked" ElementName="chb" />
                    <Binding  Path="IsChecked" ElementName="chbIsFile" />
                    <Binding  Path="IsChecked" ElementName="chbSHA1" />
                </MultiBinding>
            </TextBox.Text>
        </TextBox>

        <CheckBox Grid.Row="4" x:Name="chbSHA256" Content="SHA256" Margin="8,10,15,0" 
                    IsChecked="{Binding Path=IsChecked,ElementName=chbAll,Mode=OneWay}"/>
        <TextBox Name="textSHA256" Grid.Row="4" Grid.Column="1" Margin="10,10,5,0" TextWrapping="Wrap">
            <TextBox.Text>
                <MultiBinding Converter="{StaticResource SHA256Converter}" Mode="TwoWay">
                    <Binding  Path="Text" ElementName="textEncrypt" />
                    <Binding  Path="IsChecked" ElementName="chb" />
                    <Binding  Path="IsChecked" ElementName="chbIsFile" />
                    <Binding  Path="IsChecked" ElementName="chbSHA256" />
                </MultiBinding>
            </TextBox.Text>
        </TextBox>

        <CheckBox Grid.Row="5" x:Name="chbSHA384" Content="SHA384" Margin="8,10,15,0" 
                  IsChecked="{Binding Path=IsChecked,ElementName=chbAll,Mode=OneWay}"/>
        <TextBox Name="textSHA384" Grid.Row="5" Grid.Column="1" Margin="10,10,5,0" TextWrapping="Wrap">
            <TextBox.Text>
                <MultiBinding Converter="{StaticResource SHA384Converter}" Mode="TwoWay">
                    <Binding  Path="Text" ElementName="textEncrypt" />
                    <Binding  Path="IsChecked" ElementName="chb" />
                    <Binding  Path="IsChecked" ElementName="chbIsFile" />
                    <Binding  Path="IsChecked" ElementName="chbSHA384" />
                </MultiBinding>
            </TextBox.Text>
        </TextBox>

        <CheckBox Grid.Row="6" x:Name="chbEncode" Content="SHA1-MD5" Margin="8,10,15,0"
                  IsChecked="{Binding Path=IsChecked,ElementName=chbAll,Mode=OneWay}"/>
        <TextBox Name="textEncode" Grid.Row="6" Grid.Column="1" Margin="10,10,5,0" TextWrapping="Wrap">
            <TextBox.Text>
                <MultiBinding Converter="{StaticResource EncodeConverter}" Mode="TwoWay">
                    <Binding  Path="Text" ElementName="textEncrypt" />
                    <Binding  Path="IsChecked" ElementName="chb" />
                    <Binding  Path="IsChecked" ElementName="chbIsFile" />
                    <Binding  Path="IsChecked" ElementName="chbEncode" />
                </MultiBinding>
            </TextBox.Text>
        </TextBox>

        <CheckBox Grid.Row="7" x:Name="chbCRC32" Content="CRC32" Margin="8,10,15,0"
                  IsChecked="{Binding Path=IsChecked,ElementName=chbAll,Mode=OneWay}"/>
        <TextBox Name="textCRC32" Grid.Row="7" Grid.Column="1" Margin="10,10,5,0" TextWrapping="Wrap">
            <TextBox.Text>
                <MultiBinding Converter="{StaticResource CRC32Converter}" Mode="TwoWay">
                    <Binding  Path="Text" ElementName="textEncrypt" />
                    <Binding  Path="IsChecked" ElementName="chb" />
                    <Binding  Path="IsChecked" ElementName="chbIsFile" />
                    <Binding  Path="IsChecked" ElementName="chbCRC32" />
                </MultiBinding>
            </TextBox.Text>
        </TextBox>

        <CheckBox Grid.Row="8" x:Name="chbMD4" Content="MD4" Margin="8,10,15,0"
                  IsChecked="{Binding Path=IsChecked,ElementName=chbAll,Mode=OneWay}"/>
        <TextBox Grid.Row="8" Grid.Column="1" Margin="10,10,5,0" TextWrapping="Wrap">
            <TextBox.Text>
                <MultiBinding Converter="{StaticResource MD4Converter}" Mode="TwoWay">
                    <Binding  Path="Text" ElementName="textEncrypt" />
                    <Binding  Path="IsChecked" ElementName="chb" />
                    <Binding  Path="IsChecked" ElementName="chbIsFile" />
                    <Binding  Path="IsChecked" ElementName="chbMD4" />
                </MultiBinding>
            </TextBox.Text>
        </TextBox>

        <CheckBox Grid.Row="9" x:Name="chbNTLM" Content="NTLM" Margin="8,10,15,0"
                  IsChecked="{Binding Path=IsChecked,ElementName=chbAll,Mode=OneWay}"/>
        <TextBox Grid.Row="9" Grid.Column="1" Margin="10,10,5,0" TextWrapping="Wrap">
            <TextBox.Text>
                <MultiBinding Converter="{StaticResource NTLMConverter}" Mode="TwoWay">
                    <Binding  Path="Text" ElementName="textEncrypt" />
                    <Binding  Path="IsChecked" ElementName="chb" />
                    <Binding  Path="IsChecked" ElementName="chbIsFile" />
                    <Binding  Path="IsChecked" ElementName="chbNTLM" />
                </MultiBinding>
            </TextBox.Text>
        </TextBox>

        <WrapPanel Grid.Row="10" Grid.ColumnSpan="2" Margin="10,5,5,5"  HorizontalAlignment="Left">
            <Button x:Name="btnMD5" Content="MD5 Check" Width="80" Margin="5"  Click="btnMD5_Click" >
                <Button.Visibility>
                    <MultiBinding Converter="{StaticResource VisiableButonConverter}" Mode="OneWay">
                        <Binding  ElementName="textMD5" Path="Text"/>
                        <Binding ElementName="chbIsFile" Path="IsChecked" />
                        <Binding ElementName="chbMD5" Path="IsChecked" />
                    </MultiBinding>
                </Button.Visibility>
            </Button>
            <Button x:Name="btnSHA1" Content="SHA1 Check" Width="80" Margin="5"  Click="btnSHA1_Click">
                <Button.Visibility>
                    <MultiBinding Converter="{StaticResource VisiableButonConverter}" Mode="OneWay">
                        <Binding  ElementName="textSHA1" Path="Text"/>
                        <Binding ElementName="chbIsFile" Path="IsChecked" />
                        <Binding ElementName="chbSHA1" Path="IsChecked" />
                    </MultiBinding>
                </Button.Visibility>
            </Button>

            <Button x:Name="btnSHA256" Content="SHA2 Check" Width="80" Margin="5"  Click="btnSHA256_Click">
                <Button.Visibility>
                    <MultiBinding Converter="{StaticResource VisiableButonConverter}" Mode="OneWay">
                        <Binding  ElementName="textSHA256" Path="Text"/>
                        <Binding ElementName="chbIsFile" Path="IsChecked" />
                        <Binding ElementName="chbSHA256" Path="IsChecked" />
                    </MultiBinding>
                </Button.Visibility>
            </Button>

            <Button x:Name="btnSHA384" Content="SHA3 Check" Width="80" Margin="5"  Click="btnSHA384_Click">
                <Button.Visibility>
                    <MultiBinding Converter="{StaticResource VisiableButonConverter}" Mode="OneWay">
                        <Binding  ElementName="textSHA384" Path="Text"/>
                        <Binding ElementName="chbIsFile" Path="IsChecked" />
                        <Binding ElementName="chbSHA384" Path="IsChecked" />
                    </MultiBinding>
                </Button.Visibility>
            </Button>

            <Button x:Name="btnSHA1MD5" Content="S-M Check" Width="80" Margin="5" Click="btnSHA1MD5_Click" >
                <Button.Visibility>
                    <MultiBinding Converter="{StaticResource VisiableButonConverter}" Mode="OneWay">
                        <Binding  ElementName="textEncode" Path="Text"/>
                        <Binding ElementName="chbIsFile" Path="IsChecked" />
                        <Binding ElementName="chbEncode" Path="IsChecked" />
                    </MultiBinding>
                </Button.Visibility>
            </Button>

            <Button x:Name="btnCRC32" Content="CRC32 Check" Width="80" Margin="5"  Click="btnCRC32_Click">
                <Button.Visibility>
                    <MultiBinding Converter="{StaticResource VisiableButonConverter}" Mode="OneWay">
                        <Binding  ElementName="textCRC32" Path="Text"/>
                        <Binding ElementName="chbIsFile" Path="IsChecked" />
                        <Binding ElementName="chbCRC32" Path="IsChecked" />
                    </MultiBinding>
                </Button.Visibility>
            </Button>
        </WrapPanel>
    </Grid>
</Window>
